/**
 * 
 */
package com.et114.components.xfire.junit;

import java.net.MalformedURLException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
import org.springframework.util.Assert;

import junit.framework.TestCase;

/*
 * @author guahw
 */
public class BaseXfireTestCase extends TestCase {
	protected Log logger = LogFactory.getLog( this.getClass( ) );
	protected  XFireProxyFactory serviceFactory = new XFireProxyFactory();
	public void setUp() {
	
	}
	
	protected  Object getClient( String serviceURL, Class serviceClass ) {
		Assert.notNull( serviceURL );
		Assert.notNull( serviceClass );
		Service serviceModel = new ObjectServiceFactory().create( serviceClass );
		try {
			return  ( Object  ) serviceFactory.create( serviceModel, serviceURL );
		} catch ( MalformedURLException e ) {
			logger.error( e.getMessage(), e );
			return null;
		}
	}
}
